# noise_revocation_engine.py
import torch

class NoiseRevocationEngine:
    """Implements noise cancellation in aggregated global model"""
    
    @staticmethod
    def apply_noise(model_params, noise_vector):
        """
        Inject isomorphic noise into model parameters
        
        Args:
            model_params (list): List of model parameters
            noise_vector (torch.Tensor): Isomorphic noise vector
            
        Returns:
            list: Noisy model parameters
        """
        return [param + noise_vector for param in model_params]
    
    @staticmethod
    def remove_noise(noisy_params, noise_vector):
        """
        Remove isomorphic noise from model parameters
        
        Args:
            noisy_params (list): List of noisy model parameters
            noise_vector (torch.Tensor): Isomorphic noise vector
            
        Returns:
            list: Clean model parameters
        """
        return [param - noise_vector for param in noisy_params]
